{include file="common/_header-css"}
{include file="common/_jQuery"}
<body>
<div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="">首页</a>
        <a href="">系统配置</a>
        <a>
          <cite>员工级别配置</cite></a>
      </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
        <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
</div>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body ">

                </div>
                <div class="layui-card-header">
                    <button class="layui-btn" onclick="xadmin.open('添加员工号','{:url(\'staff_add\')}',400,400)"><i class="layui-icon"></i>添加员工号</button>
                    <button type="button" class="layui-btn" name="excel" id="excel"><i class="layui-icon">&#xe67c;</i>上传Excel</button>
                </div>
                <div class="layui-card-body ">
                    <table class="layui-table layui-form">
                        <thead>
                        <tr>
                            <th>ID</th>
                            <th>员工号</th>
                            <th>级别</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        {volist name="list" id="vo"}
                        <tr>
                            <td>{$vo.id}</td>
                            <th>{$vo.user_account}</th>
                            <th>{$vo.level_name}</th>
                            <td class="td-manage">
                                <a title="删除" onclick="member_del(this,'{$vo.id}')" href="javascript:;">
                                    <i class="layui-icon">&#xe640;</i>
                                </a>
                            </td>
                        </tr>
                        {/volist}
                        </tbody>
                    </table>
                </div>
                <div class="layui-card-body ">
                    <div class="page">
                        <div>
                            {$list|raw}
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    layui.use(['laydate','form'], function(){
        var laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
            elem: '#start' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
            elem: '#end' //指定元素
        });
    });


    /*用户-删除*/
    function member_del(obj,id){
        layer.confirm('确认要删除吗？',function(index){
            $.post('{:url(\'staff_delete\')}',{id:id,type:3},function (res) {
                if (res.code == 200) {
                    $(obj).parents("tr").remove();
                    layer.msg(res.msg,{icon:1,time:1000});
                }else{
                    layer.msg(res.msg,{icon:5,time:500});
                }
            });
        });
    }
</script>

<script>
    layui.use('upload', function(){
        var upload = layui.upload;

        // -- 判断题
        upload.render({
            elem: '#excel' //绑定元素
            ,url: '{:url(\'config/upload_excel\')}' //上传接口
            ,done: function(res){
                if (res.code == 200){
                    layer.msg(res.msg,{icon:1,time:500},function () {
                        location.reload();
                    });
                }else{
                    layer.msg(res.msg,{icon:5,time:1000});
                }
            }
            ,error: function(){
                //请求异常回调
            }
            ,accept: 'file'
            ,size: 50
        });
    });
</script>
</body>

</html>